<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="ERP领料信息报表" />

<%@ include file="/common/report_head.jsp" %>
<%@ include file="/condition/sartTime_input.html"%>
<%@ include file="/condition/endTime_input.html"%>
<%@ include file="/condition/mtrlFabId_sumo.html"%>
<%@ include file="/condition/mtrlProdId_text.html"%>
<%@ include file="/condition/summaryOrDetail_radio.html"%>

<%@ include file="/common/report_middle.jsp" %>
<div class="col-md-12" style="height: 820px;">
    <div id="pqGrid"></div>
</div>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("ERP领料信息报表");

        $('#query_btn').click(function (){
            initGridAndChart();
            ajax('/jn-report/report/erpPicking_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.gridData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //grid表格数据
                var colM;
                if ($.trim($("#summaryOrDetailRadio input:checked").val()) == "SUMMARY") {
                    colM = [
                        {halign:"center",align:'center', dataIndx: 'mtrl_prod_id_fk',   title: '物料代码',	    width: 140,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_name',         title: '物料名称',	    width: 550,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_spec',		    title: '物料规格',	    width: 480,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_unit',		    title: '物料单位',	    width: 130,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_qty',	        title: '领用数量',	    width: 130,   editable: false, sortable: true}
                    ];
                }else if ($.trim($("#summaryOrDetailRadio input:checked").val()) == "DETAIL") {
                    colM = [
                        {halign:"center",align:'center', dataIndx: 'pick_date',	        title: '领料年月日',    width: 110,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'pick_time',	        title: '领料时间',      width: 110,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'fab_id',            title: '备品备件仓',	width: 130,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'fab_id_fk',         title: '备品备件仓',	width: 130,   editable: false, sortable: true, hidden: true},
                        {halign:"center",align:'center', dataIndx: 'pick_id',           title: 'ERP领料单号',	width: 150,    editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_prod_id_fk',   title: '物料代码',	    width: 120,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_name',         title: '物料名称',	    width: 350,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_spec',		    title: '物料规格',	    width: 320,   editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_unit',		    title: '物料单位',	    width: 90,     editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'mtrl_qty',	        title: '领料数量',	    width: 90,     editable: false, sortable: true},
                        {halign:"center",align:'center', dataIndx: 'note',	            title: '备注信息',      width: 200,    editable: false, sortable: true}
                    ];
                }
                _pqUtil.f.setColModel($("#pqGrid"), colM);
                if ($.trim($("#summaryOrDetailRadio input:checked").val()) == "SUMMARY") _pqUtil.f.seTitle($("#pqGrid"), "ERP领料信息汇总");
                if ($.trim($("#summaryOrDetailRadio input:checked").val()) == "DETAIL") _pqUtil.f.seTitle($("#pqGrid"), "ERP领料信息明细");
                _pqUtil.f.loadPqGridData($("#pqGrid"), outTrxObj.gridData);
            };
        });
    });
</script>
